import 'package:flutter/material.dart';
import '../pages/bottom_navigation_bar.dart';
import '../pages/search.dart';
import '../pages/user/registerFirst.dart';
import '../pages/user/login.dart';
import '../pages/demo/dialog.dart';
import '../pages/demo/page_view_swiper.dart';
import '../pages/demo/pageViewKeepALive.dart';
import '../pages/animated/animated_list.dart';
import '../pages/mix/basic_message_channel.dart';
import '../pages/demo/form.dart';
import '../pages/demo/grid_view.dart';
//滤镜
import '../pages/Effect/Blur.dart';
//动画
import '../pages/animated/animated.dart';
import '../pages/animated/animated_1.dart';
import '../pages/animated/animated_2.dart';
import '../pages/animated/animated_3.dart';
import '../pages/animated/animated_4.dart';
import '../pages/animated/animated_5.dart';
import '../pages/animated/animated_6.dart';
import '../pages/animated/animated_7.dart';
import '../pages/animated/animated_8.dart';
import '../pages/animated/animated_animated_container.dart';
import '../pages/animated/animated_animated_padding.dart';
import '../pages/animated/animated_add_goods.dart';
import '../pages/Effect/picture_fly_in.dart';
//getx
import '../pages/getx/dialog.dart';
/// 路由配置
Map routes = {
  "/": (context, {arguments}) => BottomNavigationBarPage(arguments: arguments),
  "/search": (context) => SearchPage(),
  "/basicMessageChannel": (context) => BasicMessageChannelPage(),
  "/form": (context, {arguments}) => FormPage(arguments: arguments),
  "/registerFirst": (context) => RegisterFirstPage(),
  "/login": (context) => LoginPage(),
  "/dialog": (context) => DialogPage(),
  "/pageViewSwiper": (context) => PageViewSwiper(),
  "/pageViewKeepAlive": (context) => PageViewKeepAlive(),
  ///动画
  "/animatedList": (context) => AnimatedListPage(),
  "/basicMessageChannel": (context) => BasicMessageChannelPage(),
  "/gridView": (context) => GridViewPage(),
  //滤镜
  "/blur": (context) => BlurPage(),

  //动画
  "/animated": (context) => AnimatedPage(),
  "/animated_animated_container": (context) => AnimatedAnimatedContainerPage(),
  "/animated_animated_padding": (context) => AnimatedAnimatedPaddingPage(),
  "/animatedAddGoods": (context) => AnimatedAddGoodsPage(),
  "/animated1": (context) => Animated1Page(),
  "/animated2": (context) => Animated2Page(),
  "/animated3": (context) => Animated3Page(),
  "/animated4": (context) => Animated4Page(),
  "/animated5": (context) => Animated5Page(),
  "/animated6": (context) => Animated6Page(),
  "/animated7": (context, {arguments}) => AnimatedHeroPage(arguments: arguments),
  "/animated8": (context, {arguments}) => Animated8Page(arguments: arguments),
  "/pictureFlyIn": (context) => PictureFlyInPage(),
  // get
  "/getxDialog": (context) => GetXDialogPage(),
};

///配置 onGenerateRoute 固定写法
var onGenerateRoute = (RouteSettings settings) {
  // 获取路由名称和参数
  final String? name = settings.name;
  // 获取路由构造函数
  final Function? pageContentBuilder = routes[name];
  // 判断路由构造函数是否为空
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
        builder: (context) =>
            pageContentBuilder(context, arguments: settings.arguments),
      );
      return route;
    } else {
      final Route route = MaterialPageRoute(
        builder: (context) => pageContentBuilder(context),
      ); // Materia
      return route;
    }
  }
  return null;
};
